home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
sound
/
samplecruncher
/
interface.lha
/
rexx
/
scruncher.rexx
Wrap
OS/2 REXX Batch file
|
1999-06-04
|
6KB
|
220 lines
/*************************************************************************/
/* $VER: Sample scruncer interface */
/*************************************************************************/
/* assign scruncher: work:temp/scruncher */
gui_file = 'ram:rexx/gui/scruncher.gui'
IF EXISTS("libs:rexxsupport.library") THEN DO
IF ~SHOW("L","rexxsupport.library") THEN
IF ~ADDLIB("rexxsupport.library",0,-30,0) THEN EXIT
END
ELSE EXIT
IF EXISTS("libs:rexxtricks.library") THEN DO
IF ~SHOW("L","rexxtricks.library") THEN
IF ~ADDLIB("rexxtricks.library",0,-30) THEN EXIT
END
ELSE EXIT
OPTIONS RESULTS
OPTIONS FAILAT 10
SIGNAL ON SYNTAX
SIGNAL ON FAILURE
/* Get the GUI file from the user */
IF gui_file = '' THEN
DO
gui_file=rtfilerequest('REXX:gui',,'Varexx Request','_Load','rt_reqpos=reqpos_centerscr rtfi_matchpat=#?.gui rtfi_flags=freqf_patgad')
IF gui_file = '' THEN EXIT
END
/* Check Varexx is loaded if not load it */
IF SHOW( 'p', 'VAREXX' ) ~= 1 THEN DO
ADDRESS COMMAND "run >NIL: varexx"
ADDRESS COMMAND "WaitForPort VAREXX"
END
ADDRESS VAREXX
IF OPENPORT("SCRUNCH") = 0 THEN DO
say "Could not open a port. Varexx Error."
EXIT
END
'load ' gui_file 'SCRUNCH PS=OCTAMED' /*go to octamed screen */
vhost = RESULT
ADDRESS VALUE vhost
show
/**************************************************************************/
/* MAIN LOOP -- Check for GUI events */
/**************************************************************************/
/* set defaults */
/* AUTO update listview from "scruncher/transforms" */
ADDRESS value vhost
dirstring = SHOWDIR( 'scruncher:transforms' , 'f' )
i = 1
DO while dirstring ~= ""
PARSE VAR dirstring dir.i dirstring
i = i + 1
END
dir.COUNT = i - 1
dir.SELECT = i - 1
setlist listview CLEAR STEM dir
settext input ""
islooped = 0
transform = "transform.dry"
showing = 0
DO FOREVER
CALL WAITPKT("SCRUNCH")
packet = GETPKT("SCRUNCH")
IF packet ~= '00000000'x THEN DO
class = GETARG(packet)
IF class = "CLOSEWINDOW" THEN LEAVE
IF class = "GET" THEN DO
settext output "Updating file list..."
ADDRESS value vhost
dirstring = SHOWDIR( 'scruncher:transforms' , 'f' )
i = 1
DO while dirstring ~= ""
PARSE VAR dirstring dir.i dirstring
i = i + 1
END
dir.COUNT = i - 1
dir.SELECT = i - 1
setlist listview CLEAR STEM dir
settext input ""
END
IF class = "COMPARE" THEN DO
settext output "Alternate sample loaded..."
ADDRESS octamed_rexx
IN_LOAD 't:compare.1' NOSLIST
IN_SETNAME instname
ADDRESS COMMAND 'rename t:compare.1 t:compare.3'
ADDRESS COMMAND 'rename t:compare.2 t:compare.1'
ADDRESS COMMAND 'rename t:compare.3 t:compare.2'
IF islooped = 1 THEN DO
SA_SETLOOP loop_st loop_end
END
ADDRESS VALUE vhost
END
IF class = "PREV" THEN DO
ADDRESS OCTAMED_REXX in_select prev
IF showing = 1 THEN DO
ADDRESS OCTAMED_REXX in_select curr_inst
showing = 0
END
END
IF class = "NEXT" THEN DO
ADDRESS OCTAMED_REXX in_select next
IF showing = 1 THEN DO
ADDRESS OCTAMED_REXX in_select curr_inst
showing = 0
END
END
IF class = "STOP" THEN DO
ADDRESS OCTAMED_REXX pl_stop
END
IF class = "PLAY" THEN DO
ADDRESS OCTAMED_REXX sa_play d
END
IF LEFT( class , 8 ) = "LISTVIEW" THEN DO
drop transform comment
PARSE VAR class lv transform
transform = DELSTR( transform , 1 , 1 )
settext input transform
comment = GETCOMMENT( "scruncher:transforms/" || transform )
settext output comment
END
IF class = "SHOW" THEN DO
ADDRESS OCTAMED_REXX
IF showing = 0 THEN DO
drop curr_inst
in_getnumber VAR curr_inst
END
in_select last
IN_LOAD 'scruncher:transforms/upramp.256' NOSLIST
drop class
class = "GO"
ADDRESS VALUE vhost
showing = 1
END
IF class = "GO" THEN DO
settext output "Scrunching..."
ADDRESS OCTAMED_REXX /* this is the scrunch sequence: */
drop instname loop_st loop_end islooped
IN_GETNAME var instname
PL_STOP
SA_GETLOOPSTATE var islooped
IF islooped = 1 THEN DO
SA_GETLOOPSTART var loop_st
SA_GETLOOPLENGTH var loop_end
END
IN_SAVE 't:temp.raw' RAW
ADDRESS COMMAND 'rexx:samplescruncher i=t:temp.raw o=t:temp l=scruncher:transforms/' || transform
IN_LOAD 't:temp' NOSLIST
ADDRESS COMMAND 'c:copy t:temp.raw t:compare.1'
ADDRESS COMMAND 'c:copy t:temp t:compare.2'
IN_SETNAME instname
CALL DELETE('t:temp.raw')
CALL DELETE('t:temp')
SA_REFRESH
IF islooped = 1 THEN DO
SA_SETLOOP loop_st loop_end
END
ADDRESS VALUE vhost
settext output "Finished."
IF show = 1 THEN settext output comment
END
END
END
'hide unload'
CALL CLOSEPORT( "SCRUNCH" )
EXIT
/* Error messages */
failure:
SAY "Error code" rc "-- Line" SIGL
SAY EXTERNERROR
'hide unload'
CALL CLOSEPORT ("SCRUNCH")
EXIT
syntax:
SAY "Error" rc "-- Line" SIGL
SAY ERRORTEXT( rc )
'hide unload'
CALL CLOSEPORT ("SCRUNCH")
EXIT